#include <iostream>
#include "ConvexHullPoint.h"
#include "ReadData.h"
using namespace std;

ConvexHullPoint::ConvexHullPoint() {
	x = 0;
	y = 0;
}

ConvexHullPoint::ConvexHullPoint(int px, int py) {
	x = px;
	y = py;
}

ConvexHullPoint::ConvexHullPoint(const ConvexHullPoint &pt) {
	*this = pt;
}

bool ConvexHullPoint::operator <(const ConvexHullPoint &pt) {
	if (x < pt.x)
		return true;
	else
		return false;
}

bool ConvexHullPoint::operator <=(const ConvexHullPoint &pt) {
	if (x <= pt.x)
		return true;
	else
		return false;
}

bool ConvexHullPoint::operator >(const ConvexHullPoint &pt) {
	if (x > pt.x)
		return true;
	else
		return false;
}

ConvexHullPoint &ConvexHullPoint::operator =(const ConvexHullPoint &pt) {
	x = pt.x;
	y = pt.y;
	return *this;
}

ostream & operator<<(ostream &out, const ConvexHullPoint &pt) {
	out<<"("<<pt.GetX()<<","<<pt.GetY()<<")";
	return out;
}

void ConvexHullPoint::SetPoint(int px, int py) {
	x = px;
	y = py;
}

int ConvexHullPoint::GetX() const {
	return x;
}

int ConvexHullPoint::GetY() const {
	return y;
}

void CreatePoints(vector<ConvexHullPoint> &points) {
	vector<int> data = ReadData();
	for (int i = 0; i < data.size() - 1; i += 2) {
		ConvexHullPoint temp;
		temp.SetPoint(data[i], data[i + 1]);
		points.push_back(temp);
	}
}
